package com.auxgroup.hr.front.site.co.personnel;

import java.math.BigDecimal;
import java.util.List;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.auxgroup.hr.front.commons.vo.BaseResponseVO;
import com.auxgroup.hr.front.dao.domain.PsCFamilyTbl;
import com.auxgroup.hr.front.dao.domain.PsCPersonalInfoClass;
import com.auxgroup.hr.front.dozer.IObjectMapper;
import com.auxgroup.hr.front.service.personnal.FamilyTblService;
import com.auxgroup.hr.front.site.co.BaseCO;

/**
 * 家庭情况CO
 * 
 * @author wangchangyun
 * @version 创建时间：180523
 */
@RestController
@RequestMapping("${auxgroup.hr.contextPath}/familyTbl")
public class FamilyTblCO extends BaseCO {

	private static final Logger logger = LoggerFactory.getLogger(FamilyTblCO.class);

	@Autowired
	public FamilyTblService familyTblService;

	@Resource(name = "dozerMapper")
	protected IObjectMapper objectMapper;

	/**
	 * 获取全部
	 * 
	 * @return
	 */
	@GetMapping(value = "/getAll")
	public BaseResponseVO getAll(String emplid) {
		logger.info("getFamilyTbl param= {}", emplid);
		List<PsCFamilyTbl> list = familyTblService.getAll(emplid);
		return buildRespone(list);
	}
	
	/**
	 * 获取家庭情况
	 * 
	 * @return
	 */
	@GetMapping(value = "/getOne")
	public BaseResponseVO getOne(String emplid, BigDecimal cSeqno) {
		logger.info("getFamilyTbl param= {}", emplid);
		PsCPersonalInfoClass personalInfo = new PsCPersonalInfoClass(emplid, cSeqno);
		PsCFamilyTbl familyTbl = familyTblService.getFamilyTbl(personalInfo);
		return buildRespone(familyTbl);
	}

}
